import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Layout from '../layout/index.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: () => import( '../views/home/index.vue'),
        name: 'Home',
        meta: { title: '首页', icon: 'home', affix: true }
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    // redirect: '/managementarticles',
    children: [
      {
        path: 'managementarticles',
        component: () => import( '@/views/contentmanagement/article/index.vue'),
        name: 'ManagementArticles',
        meta: { title: '文章管理', icon: 'document', affix: true }
      },
      {
        path: 'statisticalarticle',
        component: () => import( '@/views/contentmanagement/static/index.vue'),
        name: 'StatisticalArticle',
        meta: { title: '文章统计', icon: 'static', affix: true }
      },
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
